/**
 * Created by zhangzhihao on 2016/12/06 11:00;
 */
var vm = new Vue({
    el: "#main",
    data: {
        listArry: [],
        id: "",
        businessNo: "",
        stateValue: "",
        appliName: "",
        nowPage:1,
        rowNum:10,
        allPages:0,
        pagination: [],
        pageNum: '',
    },
    created: function() {
        this.queryUser();
        // this.queryUser();
        // this.queryUserType();
        // setTimeout(function() {
        //     $('#optType').on('change', function() {
        //         vm.queryData.object.optType = $(this).val();
        //     });
        //     $('#optStatus').on('change', function() {
        //         vm.queryData.object.optStatus = $(this).val();
        //     });
        // }, 1);
    },
    methods: {
         //分页
        selectPage(page){
            this.nowPage = page;
            this.queryUser();
        },
        offsetPage(offset){
            this.nowPage = this.nowPage + offset;
            this.queryUser();
        },
        queryUser() {
            const _this = this;
            let obj = {
                appliName: _this.appliName,
                businessNo: _this.businessNo, //业务识别号（保单号）
                nowPage:this.nowPage,
                rowNum:this.rowNum,
            };
            console.log(obj)
            axios({
                    method: "post",
                    // url: "http://localhost:9000/slxt-web/collect/queryDataList",
                    url: App.envUrl.backtrackUrl+"quality/queryDataList",      // 测试地址
                    // url: 'http://192.168.43.141:8088/slxt-web/quality/queryDataList',  // 文华本地
                    data: obj,
                })
                .then((data) => {
                    console.log(data.data.pageCount.datas);
                    var list = data.data.pageCount.datas;
                    // this.nowPage = data.data.pageCount.nowPage;
                    this.allPages = data.data.pageCount.allPages;
                    this.pagination = getPagination(this.nowPage,this.allPages);
                    list.forEach((element) => {
                        element.stateValue = "";
                        if (element.auditState == 0) {
                            element.stateValue = "未审核";
                        } else if (element.auditState == 1) {
                            element.stateValue = "通过";
                        } else if (element.auditState == 2) {
                            element.stateValue = "拒绝";
                        } else if (element.auditState == 3) {
                            element.stateValue = "待审核";
                        }
                    });
                    _this.listArry = list;
                })
                .catch((err) => {});
        },
        resetBtn() {
            const _this = this;
            _this.businessNo = "";
            _this.appliName = "";
            _this.queryUser()
        },
        checkModio(item) {
        	window.location.href = "newReplay_new.html?id=" + item.id + "&businessNo=" + (item.businessNo || '') + "&pluginName=" + (item.pluginName || '') + "&pluginVersion=" + (item.pluginVersion || '');
        },
    },
});

function rowNumChange(value) {
    vm.queryData.rowNum = value;
    vm.queryData.nowPage = 1;
    vm.queryUser();
}